package com.qeeyou.apps.android.craftsman.activity.me;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.qeeyou.apps.android.craftsman.R;

public class ShareActivity extends Activity {

    private LinearLayout btnWeixin;
    private LinearLayout btnFriendCircle;
    private LinearLayout btnSina;
    private LinearLayout btnQQ;
    private Button btnCancel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_share);
        getWindow().setLayout(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);

        setView();

        setEvent();
    }

    private void setView() {
        btnWeixin = (LinearLayout) this.findViewById(R.id.btnWeixin4Share);
        btnFriendCircle = (LinearLayout)this.findViewById(R.id.btnFriendCircle4Share);
        btnSina = (LinearLayout)this.findViewById(R.id.btnSina4Share);
        btnQQ = (LinearLayout)this.findViewById(R.id.btnQQ4Share);
        btnCancel = (Button) this.findViewById(R.id.btnCancel4Share);
    }

    private void setEvent() {
        btnWeixin.setOnClickListener(onItemClickListener);
        btnFriendCircle.setOnClickListener(onItemClickListener);
        btnSina.setOnClickListener(onItemClickListener);
        btnQQ.setOnClickListener(onItemClickListener);
        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ShareActivity.this.finish();
            }
        });

    }

    private View.OnClickListener onItemClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(view == btnWeixin) {
                Toast.makeText(ShareActivity.this, "分享给微信好友", Toast.LENGTH_SHORT).show();
            } else if(view == btnFriendCircle) {
                Toast.makeText(ShareActivity.this, "分享到微信朋友圈", Toast.LENGTH_SHORT).show();
            } else if(view == btnSina) {
                Toast.makeText(ShareActivity.this, "分享到新浪微博", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(ShareActivity.this, "分享给QQ好友", Toast.LENGTH_SHORT).show();
            }
        }
    };
}
